package com.wangtianxiang.sxp.dto;

import lombok.Data;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

@Data
public class BasePageParamDto implements Serializable {

    @NotNull(message="页码不能为空")
    @Min(value=1,message="页码由1开始")
    private Long page;

    @NotNull(message="分页大小不能为空")
    @Min(value=1,message="分页大小由1开始")
    private Long pageSize;

    private String search;

    public long getStartIndex(){
        return (page - 1) * pageSize;
    }
}
